<%--
  Created by IntelliJ IDEA.
  User: 86157
  Date: 2023/1/31
  Time: 16:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>

<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>登录</title>

    <link href="${pageContext.request.contextPath}/statics/css/sb-admin-2.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.6.2.js"></script>
    <script src="${pageContext.request.contextPath}/statics/assets/layer/layer.js" type="text/javascript"></script>

    <script>
        $(function (){
            $("#riderlogin").click(function (){
                $("#conpwd").css({display:'none'})
                $("#conloginname").css({display:'none'})
                $("#nologinname").css({display:'none'})
                var login_name=$("#login_account").val();
                var login_pwd=$("#login_pwd").val();
                $.post("${pageContext.request.contextPath}/rider/login",{'login_name':login_name,'login_pwd':login_pwd},function (e){
                if (e.code==200){
                    alert(e.message);
                    window.location.href="${pageContext.request.contextPath}/rider/index";
                }else {
                    if (e.message=="用户名不存在"){
                        $("#conloginname").css({display:'block'})
                    }else if(e.message=="用户名或密码错误"){
                        $("#conpwd").css({display:'block'})
                    }else if (e.message=="用户还没有审核"){
                        $("#nologinname").css({display:'block'})
                    }else{
                        alert(e.message)
                    }
                }
            },"json")
        })
        //     $("#loginsubmit").click(function (){
        //
        //     })
        })
    </script>
</head>

<body class="bg-gradient-primary">

<div class="container">

    <!-- Outer Row -->
    <div class="row justify-content-center">

        <div class="col-xl-10 col-lg-12 col-md-9">

            <div class="card o-hidden border-0 shadow-lg my-5">
                <div class="card-body p-0">
                    <!-- Nested Row within Card Body -->
                    <div class="row">
                        <div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
                        <div class="col-lg-6">
                            <div class="p-5">
                                <div class="text-center">
                                    <h1 class="h4 text-gray-900 mb-4">欢迎回来!</h1>
                                </div>
                                <div style="display: none;color: red" id="conpwd">用户名或密码错误</div>
                                <div style="display: none;color: red" id="conloginname">用户名不存在</div>
                                <div style="display: none;color: red" id="nologinname">用户还没有审核</div>
                                <form method="post" action="${pageContext.request.contextPath}/rider/login" enctype="application/x-www-form-urlencoded">
                                    <div class="form-group">
                                        <input type="text" class="form-control form-control-user" id="login_account" name="login_name" placeholder="请输入账号">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" class="form-control form-control-user" id="login_pwd" name="login_pwd" placeholder="请输入密码">
                                    </div>
                                    <div class="form-group">
                                        <div class="custom-control custom-checkbox small">
                                            <input type="checkbox" class="custom-control-input" id="customCheck">
                                            <label class="custom-control-label" for="customCheck">Remember Me</label>
                                        </div>
                                    </div>
                                    <font color="red"></font>
                                    <button type="button" class="btn btn-primary btn-user btn-block" id="riderlogin" >登录</button>
                                    <hr>
                                </form>
                                <hr>
                                <div class="text-center">
                                    <a class="small" href="${pageContext.request.contextPath}/rider/register">注册账号!</a>                  </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body></html>
